function adverLoop() {
    var dTimer = setTimeout(function () {
        var adver = document.createElement("div");
        adver.className = "adver";

        var adverTop = document.createElement("div");
        adverTop.className = "adver-top";
        adver.appendChild(adverTop);

        var adverTitle = document.createElement("div");
        adverTitle.className = "adver-title";
        adverTitle.textContent = "距离广告关闭还有10秒";
        adverTop.appendChild(adverTitle);

        var adverClose = document.createElement("div");
        adverClose.className = "adver-close";
        adverClose.textContent = "X";
        adverTop.appendChild(adverClose);
        adverClose.onclick = function () {
            clearTimeout(dTimer);
            clearInterval(iTimer);
            adver.remove();

            adverLoop();
        }

        var adverDetail = document.createElement("div");
        adverDetail.className = "adver-detail";
        adver.appendChild(adverDetail);

        var img = document.createElement("img");
        img.src = "../images/bzsc-dgbhz-300-250-7-5.gif";
        adverDetail.appendChild(img);

        document.body.appendChild(adver);

        var count = 10;
        var iTimer = setInterval(function () {
            count--;
            adverTitle.textContent = `距离广告关闭还有${count}秒`;
            if (count <= 0) { // 倒计时结束
                adver.remove()
                clearInterval(iTimer);

                // 等待倒计时结束 -> 重新开启下一次
                adverLoop();
            }
        }, 1000)

    }, 5000);
}
